#ifndef PINBASE_H
#define PINBASE_H

#include <QPoint>
#include <QList>

#include "wirebase.h"

class WireBase;

class PinBase
{
public:
	PinBase(QObject *parent, int x, int y, unsigned int id, unsigned char datawidth);
	~PinBase();
	void addRefWire(WireBase *refWire);
	void removeRefWire(WireBase *refWire);
	bool hasRefWire();
	unsigned int getRefCount();
	QPoint pos;
	void move(QPoint offset);
	WireBase* getRefWire(int idx);
	QObject* getParent() {return parent;};
	void changeParent(QObject *new_parent) {parent = new_parent;};
	QString getName() {return name;};
	unsigned int getID() {return id;};
	void setID(unsigned int _id) {id = _id;};
	unsigned char getDataWidth() {return datawidth;};
        void resetMemoryFlagIdx();
        void setMemoryFlagIdx(unsigned char midx) {memoryFlagIdx = midx;};
        unsigned char getMemoryFlagIdx() {return memoryFlagIdx;};

private:
	QList<WireBase *> *refWires;
	QObject *parent;
        unsigned char memoryFlagIdx;

protected:
	QString name;
	unsigned int id;
	unsigned int no;
	unsigned char datawidth;
};

#endif // PINBASE_H
